import { defHttp } from '@/utils/http/axios';
import { ErrorMessageMode } from '#/axios';
import { BaseResponse } from '@/api/base';

// 定义接口地址
enum Api {
  /** 待导入表 */
  CANDIDATES = '/toolkit/menuComponent/candidates',
  /** 批量导入 */
  IMPORTS = '/toolkit/menuComponent/imports',
}

// 定义参数类型

export interface MenuComponentPO {
  id?: number;
  creator?: String;
  createTime?: Date;
  updater?: String;
  updateTime?: Date;
  moduleName?: String;
  name?: String;
  srcPath?: String;
  remark?: String;
  status?: number;
}

export interface MenuComponentQuery {
  id?: number;
  creator?: String;
  createTime?: Date;
  updater?: String;
  updateTime?: Date;
  moduleName?: String;
  name?: String;
  srcPath?: String;
  remark?: String;
  status?: number;
}

// 定义接口方法
// 待导入表
export function candidates(params: MenuComponentQuery, mode: ErrorMessageMode = 'message') {
  return defHttp.post<BaseResponse<Array<MenuComponentPO>>>(
    {
      url: Api.CANDIDATES,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
// 批量导入
export function imports(params: string[], mode: ErrorMessageMode = 'message') {
  return defHttp.post<BaseResponse<boolean>>(
    {
      url: Api.IMPORTS,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

